package com.gopay.scheduler.shedulerx.event;

import com.gopay.scheduler.shedulerx.rdb.JobEventTracerRepository;

/**
 * @author 19371
 */
public class JobRdbListener implements JobEventListener {

    private static JobRdbListener jobRdbListener = new JobRdbListener();

    private JobEventTracerRepository repository = JobEventTracerRepository.getSingle();

    private JobRdbListener() {
    }

    public static JobRdbListener getSingle(){
        return jobRdbListener;
    }

    @Override
    public void listen(TriggerMisfireEvent misfireEvent) {
        repository.insertMisfire(misfireEvent);
    }

    @Override
    public void listen(ProcessorJobEvent processorJobEvent) {
        repository.insertTrace(processorJobEvent);
    }

    @Override
    public void listen(SchedulerEvent schedulerEvent) {
        repository.insertScheduler(schedulerEvent);
    }
}
